package com.xian.im.tcp.api;

import com.xian.im.common.model.dto.GroupDto;
import com.xian.im.common.model.session.SessionUser;
import com.xian.im.common.proto.MsgMessage;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Set;

/**
 * @program: gitee
 * @description: 用户channel API
 * @author: liru.xian
 * @create: 2021-08-27 21:44
 **/
@Api(tags = "用户channel API")
@RequestMapping("/tcp/channel/user")
public interface UserChannelApi {

    /**
     * 获取用户Session
     * @param ctxId
     * @return
     */
    @RequestMapping(value = "session/ctxId",method = RequestMethod.GET)
    SessionUser session(@RequestParam("ctxId") String ctxId);

    @RequestMapping(value = "session/userId",method = RequestMethod.GET)
    SessionUser sessionUser(@RequestParam("userId") String userId);

    /**
     * 是否参加群组
     * @param groupId
     * @param ctxId
     * @return
     */
    @RequestMapping(value = "hasGroup",method = RequestMethod.GET)
    Boolean hasGroup(@RequestParam("groupId") String groupId,@RequestParam("ctxId") String ctxId);

    /**
     * 群组绑定
     * @param entity
     * @param ctxId
     * @return
     */
    @RequestMapping(value = "bindChannelGroup/{ctxId}",method = RequestMethod.POST)
    Boolean bindChannelGroup(GroupDto entity,@PathVariable String ctxId );

    /**
     * 是否已登陆
     * @param ctxId
     * @return
     */
    @RequestMapping(value = "hasLogin",method = RequestMethod.GET)
    Boolean hasLogin(String ctxId);

    /**
     * 绑定用户session
     * @param sessionParam
     * @param ctxId
     * @return
     */
    @RequestMapping(value = "bindSession/{ctxId}",method = RequestMethod.POST)
    Boolean bindSession(SessionUser sessionParam,@PathVariable String ctxId);

    /**
     *
     * @param userId
     * @return
     */
    @RequestMapping(value = "ctxIds",method = RequestMethod.GET)
    Set<String> ctxIds(String userId);

    /**
     * 接触绑定用户session
     * @param ctxId
     * @return
     */
    @RequestMapping(value = "unBindSession",method = RequestMethod.GET)
    Boolean unBindSession(String ctxId);

    /**
     * 多端推送消息
     * @param userId
     * @param message
     * @return
     */
    @RequestMapping(value = "pushPlatformMessage/{userId}",method = RequestMethod.POST)
    Boolean pushPlatformMessage(@PathVariable String userId, MsgMessage message);

    /**
     * 单点推送普通消息
     * @param ctxId
     * @param message
     * @return
     */
    @RequestMapping(value = "pushChannelMessage/{ctxId}",method = RequestMethod.POST)
    Boolean pushChannelMessage(@PathVariable String ctxId, MsgMessage message);

    /**
     * 单点推送系统消息
     * @param ctxId
     * @param message
     * @return
     */
    @RequestMapping(value = "pushChannelSystemMessage/{ctxId}",method = RequestMethod.POST)
    Boolean pushChannelSystemMessage(@PathVariable("ctxId") String ctxId, MsgMessage message);


}
